//
//  DingDanDetailViewController.m
//  Experss
//
//  Created by wmwMAC on 17/8/3.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "DingDanDetailViewController.h"

#import "DingDanDetailImgTableViewCell.h"
#import "DingDanDetailLocationTableViewCell.h"
#import "DingDanDetailGoodsTableViewCell.h"
#import "DingDanDetailPriceTableViewCell.h"
#import "DingDanDetailPriceTableViewCell.h"
#import "DingDanDetailWordsTableViewCell.h"
#import "DingDanDetailNumberTableViewCell.h"

#import "DingDanSkuListMoldle.h"
#import "DingDanShopModle.h"
#import "DingDanDetailOrderModle.h"

#import "GoodsMingXiViewController.h"


#import "PayForViewController.h"//支付
#import "TuiHuanDetailViewController.h"//退换货
#import "PublicLanguageVController.h"//带评论

#import "WuLiuViewController.h"//查看物流

#import "CancelDingDanView.h"//提示框

static NSString *ImgIdentifier = @"DingDanDetailImgTableViewCell";
static NSString *LocationIdentifier = @"DingDanDetailLocationTableViewCell";
static NSString *GoodsIdentifier = @"DingDanDetailGoodsTableViewCell";
static NSString *PriceIdentifier = @"DingDanDetailPriceTableViewCell";
static NSString *WordsIdentifier = @"DingDanDetailWordsTableViewCell";
static NSString *NumberIdentifier = @"DingDanDetailNumberTableViewCell";


@interface DingDanDetailViewController ()<UITableViewDelegate,UITableViewDataSource,DingDanDetailGoodsTableViewCellDelegate>
@property (nonatomic, strong) NSMutableDictionary *addressDataDic;

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) DingDanDetailOrderModle *DataModle;
@property (nonatomic, strong) NSArray *dataArr;
@property (nonatomic, strong)NSMutableArray *dataArray2;


@end

@implementation DingDanDetailViewController

-(void)setPopModle:(AddressListModel *)popModle{
    _popModle = popModle;
    if (_popModle) {
        
        // 改变原有地址数据
        NSLog(@"%@",_popModle);
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = BaseColor;
    self.dataArr = [NSArray array];
    _dataArray2 = [NSMutableArray array];
    _addressDataDic = [NSMutableDictionary dictionary];
    self.navigationItem.title = @"订单详情";
    
    [self addTableviewUI];
    [self GetOrderConfirmData];
}


- (void)addTableviewUI {
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kScreen_Height-50-NAV_HEIGHT) style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = BaseColor;
    self.tableView.separatorStyle = kSpNone;
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailImgTableViewCell" bundle:nil] forCellReuseIdentifier:ImgIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailLocationTableViewCell" bundle:nil]forCellReuseIdentifier:LocationIdentifier];
    [self.tableView registerClass:[DingDanDetailGoodsTableViewCell class] forCellReuseIdentifier:GoodsIdentifier];
        [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailPriceTableViewCell" bundle:nil]forCellReuseIdentifier:PriceIdentifier];
        [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailWordsTableViewCell" bundle:nil]forCellReuseIdentifier:WordsIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailNumberTableViewCell" bundle:nil]forCellReuseIdentifier:NumberIdentifier];

    
    [self.view addSubview:self.tableView];
    
    
    
<<<<<<< HEAD

    [MBProgressHUD showText:@"立即支付"];
=======
>>>>>>> c98a3a054c6d2b10bfeb3c2412b7b107b140a99e

    
    
    
    
}



-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        return 80;
    }else if (indexPath.row == 1){
        return 100;
    }else if (indexPath.row == 2){
        return  47 + (kScreen_Width - 40 - 30 - 40)/5.0 + 26+6 + 40;
        
    }else if (indexPath.row == 3){
        self.tableView.rowHeight = UITableViewAutomaticDimension;
        self.tableView.estimatedRowHeight = 120;
        return self.tableView.rowHeight;
    }else if (indexPath.row == 4){
        return 60;
    }else{
        return 60;
    }
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 6;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    
    return self.dataArr.count ? 1:0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
//     DingDanSkuListMoldle *skuModle = self.dataArr[0];
    
    if (indexPath.row == 0) {
        DingDanDetailImgTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ImgIdentifier forIndexPath:indexPath];
        cell.HeardMoenyLB.text = [NSString stringWithFormat:@"需支付%@元",self.DataModle.order_price];
        cell.timeLB.text = self.DataModle.addtime;
        cell.payState.text = @"等待买家付款";
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }else if (indexPath.row == 1){
        DingDanDetailLocationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LocationIdentifier forIndexPath:indexPath];
        NSString *addressStr = [NSString stringWithFormat:@"%@ %@ %@ %@",self.DataModle.prov,self.DataModle.city,self.DataModle.area, _DataModle.address];
        NSString *nameAndTel = [NSString stringWithFormat:@"%@ %@",self.DataModle.full_name,self.DataModle.tel];
        cell.rightBtn.hidden = YES;
        cell.locationLable.text = addressStr;
        cell.nameLable.text = nameAndTel;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
    }else if (indexPath.row == 2){
        DingDanDetailGoodsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:GoodsIdentifier forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.delegate = self;
        
        cell.titleLabel.text = _DataModle.shop_name; //self.DataModle
        cell.stateLabel.text = _DataModle.status_name;
        cell.priceLabel.text = [NSString stringWithFormat:@"¥%@ 共%@件 重量%@kg",_DataModle.order_price,_DataModle.sku_price,_DataModle.all_sku_weight];//商品市场总价
        
        NSMutableArray *imgArr = [NSMutableArray array];
        for (DingDanSkuListMoldle *skuModle in self.dataArr) {
            [imgArr addObject:skuModle.sku_image];
        }
        cell.imageArray = imgArr;
        
        if (imgArr.count<6) {
            cell.moreImageView.hidden = YES;
        }else{
            cell.moreImageView.hidden = NO;
        }


        return cell;
    }else if (indexPath.row == 3){
        DingDanDetailPriceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PriceIdentifier forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        cell.oneMoenyLB.text = [NSString stringWithFormat:@"¥%@",_DataModle.sku_price_real];//销售价格
        
        cell.yingFuLable.text = [NSString stringWithFormat:@"应付¥%@",_DataModle.sku_price_real];//销售价格
        cell.shiFuLable.text = [NSString stringWithFormat:@"实付¥%@",_DataModle.order_price];//订单总金额
        if ([_DataModle.promotion_price isEqualToString:@"0"]) {//不优惠
            cell.titleLB.text = @"";
            cell.thirdLB.text = @"";
        }else {
            cell.titleLB.text = @"优惠";
            cell.thirdLB.text = [NSString stringWithFormat:@"-¥%@",_DataModle.promotion_price];
        }
        
        
        return cell;
    }else if (indexPath.row == 4){
        DingDanDetailWordsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:WordsIdentifier forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        cell.rightTextFiled.userInteractionEnabled = NO;
        
        //m_desc
        cell.rightTextFiled.text = _DataModle.m_desc;
        
        return cell;
    }else{
        DingDanDetailNumberTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NumberIdentifier forIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
//        cell.DingDanNumber.text = @""
        cell.xiaDanTimne.text = [NSString stringWithFormat:@"下单时间 %@",self.DataModle.addtime];
        return cell;

    }

    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    //    if (section == 0) {
    //
    //        return 40;
    //    }else {
    return 0.01;
    //    }
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = BaseColor;
    return headerView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    
        return 0.001;
    
    
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *footview = [[UIView alloc] init];
    footview.backgroundColor = BaseColor;
    
    return footview;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row ==2) {
        
        GoodsMingXiViewController *vc = [[GoodsMingXiViewController alloc] init];
        vc.goodsArray = [NSArray arrayWithArray:_dataArr];
        [self.navigationController pushViewController:vc animated:YES];
    }
}
#pragma mark ------------- 商品明细 -----------
-(void)DingDanDetailGoodsImgCellClicked{
    GoodsMingXiViewController *vc = [[GoodsMingXiViewController alloc] init];
    
    vc.goodsArray = self.dataArr;
    vc.typeStr = 1;
    [[BasePublicClass getCurrentVC].navigationController pushViewController:vc animated:YES];

}

#pragma mark －＝－＝－＝－＝－＝＝－＝－＝－＝＝＝－＝－＝获取订单数据


//http://bs.m0571.com/mobileapi/public/baishi/?service=Shop_OrderList.GetOrderDetail&userid=11&order_id=56&actoken=5cae08ae07e30637189654486bf16109.900.1504771317

-(void)GetOrderConfirmData{
    NSDictionary *saveDic = [SaveDataMethord readLoginData];
    
    NSDictionary *parameDic = @{@"userid":saveDic[@"userid"],@"order_id":_order_id,@"actoken":[Md5Apiway getMD5data:saveDic[@"userid"]]};
    
    [HttpRequest postWithURLString:POST(Shop_GetOrderDetail) parameters:parameDic success:^(id responseObject) {
        
        
        if ([[responseObject objectForKey:@"ret"] integerValue] == 200) {
            NSDictionary *dic = [[responseObject objectForKey:@"data"] objectForKey:@"order_data"];
       
            _DataModle = [DingDanDetailOrderModle mj_objectWithKeyValues:dic];
            self.dataArr = _DataModle.sku_list;
            
            
            
        //根据订单的不同状态去匹配脚部的不同按钮
            [self congureFootView:[NSString stringWithFormat:@"%@",_DataModle.status]];
            
            
        }else{
            [MBProgressHUD showText:[responseObject objectForKey:@"msg"]];
        }
        [self.tableView reloadData];
        
    } failure:^(NSError *error) {
        
    }];
    
}


#pragma mark －＝－＝－－＝－－＝－＝－＝－不同的状态显示不同的按钮
- (void)congureFootView:(NSString *)statusStr {
    //订单状态 1生成订单,2支付订单,3已经发货,4完成订单,5已经评价6退款,7部分退款8用户取消订单,9作废订单,10退款中(不确定中)
    if ([statusStr isEqualToString:@"1"]) {
        CGFloat btn_weidth = 90;
        UIView *footView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreen_Height-NAV_HEIGHT-50, kScreen_Width, 50)];
        footView.backgroundColor = [UIColor whiteColor];
        UIButton *cancelBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth*2 - 20, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"取消订单" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(cancelBtnAction)];
        cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        cancelBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        cancelBtn.clipsToBounds = YES;
        cancelBtn.layer.borderWidth = 1;
        cancelBtn.layer.borderColor = BaseColor.CGColor;
        [footView addSubview:cancelBtn];
        
        
        UIButton *conmitBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth - 10, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"立即支付" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(conmitBtnAction)];
        conmitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        conmitBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        conmitBtn.clipsToBounds = YES;
        conmitBtn.layer.borderWidth = 1;
        conmitBtn.layer.borderColor = RGBAColor(75, 170, 251, 1).CGColor;
        [conmitBtn setTitleColor:BaseBlueColor forState:UIControlStateNormal];
        [footView addSubview:conmitBtn];
        [self.view addSubview:footView];
    }
    
    //订单状态 1生成订单,2支付订单,3已经发货,4完成订单,5已经评价6退款,7部分退款8用户取消订单,9作废订单,10退款中(不确定中)
    if ([statusStr isEqualToString:@"2"]) {
        CGFloat btn_weidth = 90;
        UIView *footView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreen_Height-NAV_HEIGHT-50, kScreen_Width, 50)];
        footView.backgroundColor = [UIColor whiteColor];
        UIButton *conmitBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth - 10, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"退换货" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(tuiHuanHuoAction)];
        conmitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        conmitBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        conmitBtn.clipsToBounds = YES;
        conmitBtn.layer.borderWidth = 1;
        conmitBtn.layer.borderColor = RGBAColor(75, 170, 251, 1).CGColor;
        [conmitBtn setTitleColor:BaseBlueColor forState:UIControlStateNormal];
        [footView addSubview:conmitBtn];
        [self.view addSubview:footView];
    }
    
    
    //订单状态 1生成订单,2支付订单,3已经发货,4完成订单,5已经评价6退款,7部分退款8用户取消订单,9作废订单,10退款中(不确定中)
    if ([statusStr isEqualToString:@"3"]) {
        CGFloat btn_weidth = 90;
        UIView *footView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreen_Height-NAV_HEIGHT-50, kScreen_Width, 50)];
        footView.backgroundColor = [UIColor whiteColor];
        
        UIButton *tuiHBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth*3 - 30, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"退换货" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(tuiHuanHuoAction)];
        tuiHBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        tuiHBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        tuiHBtn.clipsToBounds = YES;
        tuiHBtn.layer.borderWidth = 1;
        tuiHBtn.layer.borderColor = RGBAColor(75, 170, 251, 1).CGColor;
        [tuiHBtn setTitleColor:BaseBlueColor forState:UIControlStateNormal];
        [footView addSubview:tuiHBtn];
        
        UIButton *cancelBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth*2 - 20, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"查看物流" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(lookPostAddress)];
        cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        cancelBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        cancelBtn.clipsToBounds = YES;
        cancelBtn.layer.borderWidth = 1;
        cancelBtn.layer.borderColor = BaseColor.CGColor;
        [footView addSubview:cancelBtn];
        
        
        UIButton *conmitBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth - 10, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"确认收货" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(sureGetGoods)];
        conmitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        conmitBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        conmitBtn.clipsToBounds = YES;
        conmitBtn.layer.borderWidth = 1;
        conmitBtn.layer.borderColor = RGBAColor(75, 170, 251, 1).CGColor;
        [conmitBtn setTitleColor:BaseBlueColor forState:UIControlStateNormal];
        [footView addSubview:conmitBtn];
        [self.view addSubview:footView];
        
    }
    
    //订单状态 1生成订单,2支付订单,3已经发货,4完成订单,5已经评价6退款,7部分退款8用户取消订单,9作废订单,10退款中(不确定中)
    if ([statusStr isEqualToString:@"4"]) {
        
        CGFloat btn_weidth = 90;
        UIView *footView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreen_Height-NAV_HEIGHT-50, kScreen_Width, 50)];
        footView.backgroundColor = [UIColor whiteColor];
        UIButton *conmitBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth - 10, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"评价" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(noCommentAction)];
        conmitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        conmitBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        conmitBtn.clipsToBounds = YES;
        conmitBtn.layer.borderWidth = 1;
        conmitBtn.layer.borderColor = RGBAColor(75, 170, 251, 1).CGColor;
        [conmitBtn setTitleColor:BaseBlueColor forState:UIControlStateNormal];
        [footView addSubview:conmitBtn];
        [self.view addSubview:footView];
        
        
    }
    
    
    
    //订单状态 1生成订单,2支付订单,3已经发货,4完成订单,5已经评价6退款,7部分退款8用户取消订单,9作废订单,10退款中(不确定中)
    if ([statusStr isEqualToString:@"8"]) {
        
        CGFloat btn_weidth = 90;
        UIView *footView = [[UIView alloc] initWithFrame:CGRectMake(0, kScreen_Height-NAV_HEIGHT-50, kScreen_Width, 50)];
        footView.backgroundColor = [UIColor whiteColor];
        UIButton *conmitBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(kScreen_Width - btn_weidth - 10, 5, btn_weidth, CGRectGetHeight(footView.frame)-10) title:@"删除订单" bgImage:nil selectBgImage:nil image:nil target:self action:@selector(deleteOrderAction)];
        conmitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        conmitBtn.layer.cornerRadius = (CGRectGetHeight(footView.frame)-10)/2.0;
        conmitBtn.clipsToBounds = YES;
        conmitBtn.layer.borderWidth = 1;
        conmitBtn.layer.borderColor = RGBAColor(75, 170, 251, 1).CGColor;
        [conmitBtn setTitleColor:BaseBlueColor forState:UIControlStateNormal];
        [footView addSubview:conmitBtn];
        [self.view addSubview:footView];
    }
    
    
    
    
    
    
    
    
}
#pragma mark -=-=-=-=-=取消订单的点击事件－＝－＝＝－
//取消订单
-(void)cancelBtnAction{
    
    //取消订单
    CancelDingDanView *CancelV = [[CancelDingDanView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    CancelV.titleStr = @"小通提示";
    CancelV.centerStr = @"真的确认取消订单吗?";
    CancelV.reloadBlock = ^(UIButton *sender){//登记回调函数，被触发就调用
        if (sender.tag == 1001) {//取消删除
            
        }
        if (sender.tag == 1002) {//确定删除
            
            [self OrderCancel];
            
        }
        
    };
    [[UIApplication sharedApplication].keyWindow addSubview:CancelV];
    
    
    
}

// 取消订单
-(void)OrderCancel{
    
    
    NSDictionary *saveDic = [SaveDataMethord readLoginData];
    NSDictionary *parameDic = @{@"userid":saveDic[@"userid"],@"order_id":_order_id};
    
    [HttpRequest postWithURLString:POST(Shop_OrderCancel) parameters:parameDic success:^(id responseObject) {
        
        if ([[responseObject objectForKey:@"ret"] integerValue] == 200) {
            if ([[responseObject objectForKey:@"code"] integerValue] != 0) {
                [MBProgressHUD showText:[[responseObject objectForKey:@"data"] objectForKey:@"msg"]];
            }else{
                [self.navigationController popViewControllerAnimated:YES];
            }
        }
        
        NSLog(@"%@",responseObject);
        
    } failure:^(NSError *error) {
        
    }];
}



#pragma mark -=-=-=-=-=立即支付的点击事件－＝－＝＝－
//立即支付
-(void)conmitBtnAction{
    PayForViewController *payF = [[ PayForViewController alloc] init];
    payF.hidesBottomBarWhenPushed = YES;
    payF.orderIdStr = _DataModle.order_no;
    payF.payMoenyStr = _DataModle.order_price;
    [self.navigationController pushViewController:payF animated:YES];
}

#pragma mark －＝－＝－＝－＝－＝退换货点击事件－＝－＝
//退换货
- (void)tuiHuanHuoAction {
    // 退货
    TuiHuanDetailViewController *vc = [[TuiHuanDetailViewController alloc] init];
    vc.orderID = _DataModle.Id;
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}
//确认收货
- (void)sureGetGoods {
    
}
//待评价
- (void)noCommentAction {
    PublicLanguageVController *pub = [[PublicLanguageVController alloc] init];
    pub.hidesBottomBarWhenPushed = YES;
    pub.typeStrTemp = @"controller";
    pub.modle2 = _DataModle;
    [self.navigationController pushViewController:pub  animated:YES];
}

//查看物流
- (void)lookPostAddress{
    
    //物流
    WuLiuViewController *wuliuVC = [[ WuLiuViewController alloc] init];
    wuliuVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:wuliuVC animated:YES];
}

//删除订单
- (void)deleteOrderAction {
    //取消订单
    CancelDingDanView *CancelV = [[CancelDingDanView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    CancelV.titleStr = @"小通提示";
    CancelV.centerStr = @"真的确认删除订单吗?";
    CancelV.reloadBlock = ^(UIButton *sender){//登记回调函数，被触发就调用
        if (sender.tag == 1001) {//取消删除
            
        }
        if (sender.tag == 1002) {//确定删除
            
            NSDictionary *saveDic = [SaveDataMethord readLoginData];
            NSDictionary *parameDic = @{@"userid":saveDic[@"userid"],@"order_id":_order_id,@"actoken":[Md5Apiway getMD5data:saveDic[@"userid"]]};
            
            [HttpRequest postWithURLString:POST(Shop_OrderListOrderDel) parameters:parameDic success:^(id responseObject) {
                if ([responseObject[@"ret"] intValue] != 200) {
                    [[DSLHUD shareDSLHUD] showTextNoActivity:@"删除订单出错" timeLength:1.5];
                    return ;
                }
        
                if(![[NSString stringWithFormat:@"%@",responseObject[@"data"][@"code"]] isEqualToString:@"0"]){
                    [MBProgressHUD showText:responseObject[@"data"][@"msg"]];
                    return;
                }
                [MBProgressHUD showText:responseObject[@"data"][@"msg"]];
                
            } failure:^(NSError *error) {
                
            }];

        }
        
    };
        [[UIApplication sharedApplication].keyWindow addSubview:CancelV];
}







@end
